<%-- 
    Document   : add_student_post
    Created on : Nov 24, 2011, 8:18:50 PM
    Author     : THIENSUHACK
--%>

<%@page import="GetData.CharsetFilter"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="GetData.DataWS"%>
<%@page import="dktc_ws.Tintuc"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
 request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    response.setContentType("text/html; charset=UTF-8"); 
    //CharsetFilter ab=new CharsetFilter();
    if(request.getParameter("matintuc")==null)
               {
        response.sendRedirect("/DKTC/admin/index.jsp?page=list_news");
        return;
    }
    
    Tintuc news = new Tintuc();
    news.setMatintuc(Integer.parseInt(request.getParameter("matintuc").trim()));
    news.setMotangan(request.getParameter("motangan"));
    news.setNoidung(request.getParameter("noidung"));
    news.setTuade(request.getParameter("tieude"));

    int result=0;
   DataWS a=new DataWS();
   
      //news.setTuade(ab.toUTF8(news.getTuade()));
   //news.setMotangan(ab.toUTF8(news.getMotangan()));
   //news.setNoidung(ab.toUTF8(news.getNoidung()));
   
   result=a.suatintuc(news.getTuade(),news.getMotangan(),news.getMatintuc(),news.getMaquantri(),news.getNgaydang(),news.getNoidung());
   if(result>0)
             {
       out.print("thanh cong");
       response.sendRedirect("/DKTC/admin/index.jsp?page=list_news");
   }
   else
       out.print("that bai");
           %>
           <div><a href="/DKTC/admin/index.jsp?page=list_news">Xem danh sách tin tức</a> | <a href="/DKTC/admin/index.jsp?page=add_news">Thêm Tin Mới</a></div>